
use com::opensource::svga::MovieEntity;
use napi_derive_ohos::napi;
use napi_ohos::bindgen_prelude::Uint8Array;
use quick_protobuf::{BytesReader, MessageRead};

mod com;

#[napi]
pub fn get_buffer(buf: Uint8Array) -> MovieEntity {
  let bytes = buf;

  let mut reader: BytesReader = BytesReader::from_bytes(&bytes);

  let movie_entity  = MovieEntity::from_reader(&mut reader, &bytes).unwrap();
  
  return movie_entity;
}